Skip to content

fix(id): shell contract — join.device_input is nullable, as the host has always accepted - #12710

Merged
dezren39 merged 1 commit into
mainfrom
archer-lane-ba/12703-shell-contract
Nov 22, 2026
Merged

dezren39 merged 1 commit into
mainfrom
archer-lane-ba/12703-shell-contract

Conversation

@dezren39

@dezren39 dezren39 commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

What

One-line correction to pkgs/id/contract/shell-contract.v1.json: join.device_input is declared "nullable": true (was false).

Diagnosis — the contract declaration was the wrong side

  • The host field is device_input: Option<serde_json::Value> with #[serde(default)] (crates/id-worlds/src/world_session/types.rs), landed in fix(id): validate forms against presenter input #12281 (a264773). Serde maps an explicit JSON null to None — identical to the field being absent — and every consumer treats the two alike (descriptive session metadata, not an authority grant).
  • The contract only declared the field hours later (da4617d, fixing a web-unit red), with nullable: false copied from the neighboring bool fields. Bools genuinely reject null; Option<_> fields do not. Every other Option-typed field in the contract is declared nullable (resume_token, screen_subscribe region/event_classes, the u64? shorthand on join.after).
  • So the host has accepted device_input: null since the field existed; the declaration misstated it. This change corrects the document to describe the host. The wire protocol does not change, and no revision bump: declaring/correcting a field to match the host did not bump in da4617d either.

Evidence

  • Failing-first on pristine main @ 1402855: cargo test -p id-worlds --lib the_contracts_required_fields_are_exactly_what_the_host_requires → FAILED with the filed assertion (join.device_input: the contract and the host disagree about null, left: true, right: false, tests.rs:316).
  • With the fix (laptop, nix develop inside pkgs/id): cargo test -p id-worlds --lib → 911 passed, 0 failed.
  • Web consumers of the same JSON: bunx vitest run src/world-contract.test.ts src/screen-codec.test.ts src/world-program.test.ts → 33 passed, 0 failed.

Fixes #12703.


Get evidence
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…has always accepted

The contract declaration for join.device_input (added in da4617d,
hours after the field itself landed in #12281) said nullable: false,
copied from the neighboring bool fields. But the host field is
Option<Value> with serde(default): explicit null deserializes to None,
exactly like an absent field, and every consumer treats the two alike
(descriptive session metadata, not an authority grant). Every other
Option-typed field in the contract is declared nullable (resume_token,
screen_subscribe region/event_classes, the u64? shorthand).

The declaration was the wrong side; the host behavior is the standing
truth since #12281 and does not change. The contract document is
corrected to describe it. No revision bump: declaring/correcting a
field to match the host did not bump in da4617d either, and the
wire protocol itself is unchanged.

Fixes #12703. The named test
shell_contract::tests::the_contracts_required_fields_are_exactly_what_the_host_requires
failed on pristine main with "join.device_input: the contract and the
host disagree about null (left: true, right: false)"; with this change
the full id-worlds lib suite passes 911/911 and the web contract tests
(world-contract, screen-codec, world-program) pass 33/33.
@dezren39
dezren39 requested a review from a team as a code owner November 22, 2026 23:32
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b2115916-2355-489f-86e6-761741cd3687
Commits

Reviewing files that changed from the base of the PR and between ed19070 and 57b22ae.

Files selected for processing: 1

  • pkgs/id/contract/shell-contract.v1.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39
dezren39 merged commit 7fc0ab9 into main Nov 22, 2026
1 check passed
@dezren39
dezren39 deleted the archer-lane-ba/12703-shell-contract branch November 22, 2026 23:32
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T23:33:36.022011Z 57b22ae PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id: shell contract test fails on main — join.device_input null disagreement between contract and host

1 participant